﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Hangout.Client.Core.Authentication
{
    public class Accounts
    {
        public static bool LoggedInToFacebook()
        {
            try
            {
                return (Settings.Settings.FacebookUserID != -1);
            }
            catch (Exception ex)
            {
                Core.Exceptions.ExceptionReporting.Report(ex);
                return false;
            }

        }

        public static bool LoggedInToFoursquare()
        {
            try
            {
                return (Settings.Settings.FoursquareUserID != -1);
            }
            catch (Exception ex)
            {
                Core.Exceptions.ExceptionReporting.Report(ex);
                return false;
            }

        }

        public static bool LoggedOffAllAccounts()
        {
            if (!LoggedInToFacebook() && !LoggedInToFoursquare())
            {
                return true;
            }

            return false;
        }

        public static void DeleteUserData()
        {
            try
            {
                Settings.Settings.UserID = -1;
                Settings.Settings.UserData = null;
            }
            catch (Exception ex)
            {
                Core.Exceptions.ExceptionReporting.Report(ex);
                
            }
        }

        public static void DeleteFacebookData()
        {
            try
            {
                Settings.Settings.FacebookUserFullName = "";
                Settings.Settings.FacebookUserID = -1;
                Settings.Settings.FacebookAccessToken = "";
                Settings.Settings.FacebookAccessTokenExpires = DateTime.Now.AddDays(-30);
            }
            catch (Exception ex)
            {
                Core.Exceptions.ExceptionReporting.Report(ex);
               
            }
        }

        public static void DeleteFoursquareData()
        {
            try
            {
                Settings.Settings.FoursquareAccessToken = "";
                Settings.Settings.FoursquareUserFullName="";
                Settings.Settings.FoursquareUserID=1;
            }
            catch (Exception ex)
            {
                Core.Exceptions.ExceptionReporting.Report(ex);

            }
        }



    }
}
